#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

double first_arvage(int* p)
{
	double sum = 0;
	double age = 0;
	for (int i = 0; i < 4; i++)
		sum = sum +  * (p + i*5);
	age = sum / 4;
	return age;
}
void fail(int* p)
{
	int age = 0;
	int count = 0;
	for (int i = 0; i < 4; i++)
	{
		for (int j = 0; j < 5; j++)
			if (*(p + 4 * i + j) < 70)
			{
				count++;
				if (count > 2)
				{
					printf("%d\n", i);
					for (int t = 0; t < 5; t++)
					{
						age = age + *(p + 4 * i + t);
						printf("%d ", *(p + 4 * i + t));
					}
					printf("\n%d", age/5);
					break;
				}
			}
		count = 0;
		printf("\n");
	}
}
void excelaent(int* p)
{
	int a[4] = {0};
	int sum = 0;
	for (int i = 0; i < 4; i++)
	{
		sum = 0;
		for (int j = 0; j < 5; j++)
			sum = sum + *(p + 4 * i + j);
		a[i] = sum / 5;
		
	}
	for (int i = 0; i < 4; i++)
		for (int j = 0; j < 4; j++)
			if (a[i] < 90)
			{
				for (int t = 0; t < 5; t++)
					if (*(p + 4 * i + t) < 85)
						break;
				break;
				printf("%d ", i);
				break;
			}
			else
			{
				printf("%d ", i);
				break;
			}
}
int main()
{
	int a[4][5] = { 66,65,67,68,69,85,86,84,87,89,96,92,93,98,97,74,86,95,78,85};
	printf("%6.2lf\n", first_arvage(a));
	fail(a);
	excelaent(a);

	return 0;
}